<?php
/**
 * Created by PhpStorm.
 * User: ma
 * Date: 2017/12/25
 * Time: 11:08
 */

namespace app\common\model;


use think\Model;

class AgentManage extends Model
{
    protected $pk = 'agem_id';
    protected $type = [
        'agem_create_time'  =>  'timestamp:Y/m/d H:i:s'
    ];


    /**
     * 关联area 获取省份
     */
    public function getprovince(){
        return $this->belongsTo('Area','agem_province','id')->bind(['provincename'=>'name']);
    }

    /**
     * 关联area 获取市
     */
    public function getcity(){
        return $this->belongsTo('Area','agem_city','id')->bind(['cityname'=>'name']);
    }

    /**
     * 关联area 获取区
     */
    public function getregion(){
        return $this->belongsTo('Area','agem_region','id')->bind(['regioname'=>'name']);
    }
}